package com.my.objects;

import java.io.Serial;
import java.io.Serializable;

/**
 * @description:
 * @author: marshal
 * @date: 2021-08-24 2:13 PM
 */
public class Person implements Serializable {

    // 如果不指定序列化ID，则反序列化的时候会报错，java.io.InvalidClassException: com.my.objects.Person; local class incompatible: stream classdesc serialVersionUID = -1916688881262317798, local class serialVersionUID = -8630549244590555171
    @Serial
    private static final long serialVersionUID = -8630549244590555171L;

    private int age;
    private String name;

    public Person(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
